package com.glory.hikvisionmobile.adapter;

import android.graphics.Color;
import android.util.Log;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.hikvisionmobile.R;
import com.glory.hikvisionmobile.bean.EqpWork.EqpLotBean;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_DateUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class EqpWorkLotListAdapter extends BaseQuickAdapter<EqpLotBean, BaseViewHolder> {

    public EqpWorkLotListAdapter(@Nullable List<EqpLotBean> data) {
        super(R.layout.adapter_eqp_lot_list,data);
    }


    @Override
    protected void convert(BaseViewHolder helper, EqpLotBean item) {
        helper.setText(R.id.tvLotID,item.getLotId());
        helper.setText(R.id.tvLotNum,String.valueOf(item.getMainQty()));
        helper.setText(R.id.tvPriority,String.valueOf(item.getPriority()));
        helper.setText(R.id.tvRQTime,item.getRqTime());
        helper.setText(R.id.tvRecipe,item.getRecipeName());
        helper.setText(R.id.tvWaitTime,item.getStopTime());
        helper.setText(R.id.tvDeviceDesc,item.getPartDesc());

        if (item.getHoldState().equals("On")){
            helper.setTextColor(R.id.tvLotID, Color.RED);
            helper.setTextColor(R.id.tvLotNum, Color.RED);
            helper.setTextColor(R.id.tvPriority, Color.RED);
            helper.setTextColor(R.id.tvRQTime, Color.RED);
            helper.setTextColor(R.id.tvRecipe, Color.RED);
            helper.setTextColor(R.id.tvWaitTime, Color.RED);
            helper.setTextColor(R.id.tvDeviceDesc, Color.RED);
        }else if (item.getHoldState().equals("Off")){
            helper.setTextColor(R.id.tvLotID, Color.BLACK);
            helper.setTextColor(R.id.tvLotNum, Color.BLACK);
            helper.setTextColor(R.id.tvPriority, Color.BLACK);
            helper.setTextColor(R.id.tvWaitTime, Color.BLACK);
            helper.setTextColor(R.id.tvDeviceDesc, Color.BLACK);
        }
    }
}
